function test01() {
  //   二维数组
  let a = [
    [1, 2],
    [3, 4],
    [2, 3],
  ];
  a[1][1] = 8;
  console.log(a);
  return a;
}
function test02() {
  // let xxx
  //   使用循环计算赋值九宫格中间值 ，其值为周围八个格子之和
  //   使用循环计算赋值九宫格中间值 ，其值为周围九个值的平均值
  let a = [
    [1, 2, 4],
    [3, 4, 5],
    [2, 3, 6],
  ];
  let b = [
    [9, 0, 0],
    [0, 0, 9],
    [9, 0, 9],
  ];

  let p = 0;
  //    a[1] =[3, 4, 5];
  for (let j = 0; j < a.length; j++) {
    for (let i = 0; i < a[j].length; i++) {
      if (i == 1 && j == 1) {
        continue;
      }
      p += a[j][i];
    }
  }
  console.log(p);

  //   [1, 2, 4],
  //   let target = 0;
  //   for (let j = 0; j <= 2; j++) {
  //     for (let i = 0; i <= 2; i++) {
  //       if (i === 1 && j === 1) {
  //         continue;
  //       }
  //       target += a[j][i];
  //     }
  //   }
  //   console.log(target);
}
// 对象 可以通过[]方式获取属性
function test03() {
  let b = {
    name: "zhangsan",
    age: 12,
    hobby: ["football", "basketball"],
    shout: function () {
      console.log(this.age);
    },
    // ssss:()=>{
    //     console.log(this.age);
    // }
  };

  console.log(b["name"], b.name);
  let ss = "age";
  console.log(b[ss]);
  // for in    for in keys
  for (let key in b) {
    console.log(key, b[key]);
  }
  b.shout();
  //   b.ssss();
}

function test04() {
  let b = {
    name: "zhangsan",
    age: 12,
    hobby: ["football", "basketball"],
    shout: function () {
      console.log(this.age);
    },
  };
  b.shout();
  //   js里对象是动态类型
  // 属性、方法个数能否变化
  b.address = {
    province: "shandong",
  };
  b.laugh = function () {
    console.log("aaa",this.address);
    console.log(b.address);
  };
  b.laugh2 = ()=>{
    console.log(b.address);
  }
  console.log(b.address);
  b.laugh();
  b.laugh2();
}
// -----------------------------
// let b = test01();
// test02();
// test03();
test04();
